package com.wdg.controller;

import com.wdg.dao.LogDao;
import com.wdg.dao.StuDao;
import com.wdg.dao.UserDao;
import com.wdg.dao.impl.LogDaoImpl;
import com.wdg.dao.impl.StuDaoImpl;
import com.wdg.dao.impl.UserDaoImpl;
import com.wdg.pojo.Reg_user;
import com.wdg.pojo.Student_reg;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;

/**
 * @Author : wdg；
 * @Date : 2025/3/30 6:28；
 * @Version : v1.0.0；
 * @Description: 类描述信息；
 **/
@Controller
public class StuController {
    StuDao sdao = new StuDaoImpl();

    @RequestMapping("findStuByKey.action")
    public String findStuByKey(HttpServletRequest request, HttpServletResponse response,String key) throws Exception {
        request.setAttribute("msg", "请输入学生姓名的关键字！");
        request.setAttribute("key", key);
        ArrayList<Student_reg> stu_list = sdao.findStuByKey(key);
        if (stu_list.size() != 0) {
            request.setAttribute("lookListJSTL", stu_list);
        } else {
            request.setAttribute("err", "你要查询的关键字：<font color=red>" + key + "</font>，没有符合条件的记录！");
        }
        return "findStuByKey";
    }
}
